package com.cherrish.demo.client;

import jdk.nashorn.internal.parser.JSONParser;

import java.io.UnsupportedEncodingException;
import java.net.URISyntaxException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

/**
 * @author cherrish
 * @time 2018-12-04 11:43
 * @name SocketClientEngine
 * @desc:
 */
public class SocketClientEngine {
    public static void main(String[] args) {
        Map<String,Object> map = new HashMap<>();
        map.put("id", 1);
        map.put("method", "eth_subscribe");
        map.put("params", Arrays.asList("newHeads"));
        try {
//            WebClientEnum.CLIENT.initClient(new MsgWebSocketClient("ws://35.236.174.224:9000/"));
            MsgWebSocketClient socketClient = new MsgWebSocketClient("ws://35.236.174.224:9000");
            socketClient.connect();
//            socketClient.send("hello");
        } catch (URISyntaxException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
